package iq.jxlTest;

import java.io.File;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;

public class Test {

	/**
	 * 另外一jxl.jar包报错 版本不对 
	 * @author dingdahai
	 * @date Nov 24, 2009 4:15:02 PM
	 * @param args
	 */
	public static void main(String[] args) {
		new Test().test("src/jxlTest/Book1.xls");
		//System.out.println(new File("src/jxlTest").getAbsolutePath());
	}

	public void test(String path) {
		try {
			Workbook book = Workbook.getWorkbook(new File(path));
			// 获得第一个工作表对象
			Sheet sheet = book.getSheet(0);
			// 得到单元格

			for (int j = 1; j < sheet.getRows(); j++) {
				for (int i = 0; i < sheet.getColumns(); i++) {
					Cell cell = sheet.getCell(i, j);
					System.out.print(cell.getContents() + " ");

				}
				System.out.println();
			}
			book.close();
			
		} catch (Exception e) {
			System.out.println(e);
		}

	}
}
